import Vue from 'vue';
const getters = {
	token: (state) => {
		return !state.common.token ? Vue.prototype.$session.get('token') : state.common.token;
	},
	menuData: (state) => {
		if (state.common.menuData.length === 0) {
			return Vue.prototype.$local.get('menuData');
			// return Vue.prototype.$cryptoDecrypt(Vue.prototype.$local.get('menuData'));
		} else {
			return state.common.menuData;
		}
	},
	authButton: (state) => {
		if (state.common.authButton.length === 0) {
			return Vue.prototype.$local.get('authButton');
			// return Vue.prototype.$cryptoDecrypt(Vue.prototype.$local.get('authButton'));
		} else {
			return state.common.authButton;
		}
	},
	siteInfo: (state) => {
		if (Object.keys(state.common.siteInfo).length === 0) {
			return Vue.prototype.$local.get('siteInfo')
			// return Vue.prototype.$cryptoDecrypt(Vue.prototype.$local.get('siteInfo'));
		} else {
			return state.common.siteInfo;
		}
	},
	userInfo: (state) => {
		if (Object.keys(state.common.userInfo).length === 0) {
			return Vue.prototype.$local.get('userInfo');
			// return Vue.prototype.$cryptoDecrypt(Vue.prototype.$local.get('userInfo'));
		} else {
			return state.common.userInfo;
		}
	},
	dictConst: (state) => {
		if (Object.keys(state.common.dictConst).length === 0) {
			return Vue.prototype.$local.get('dictConst');
			// return Vue.prototype.$cryptoDecrypt(Vue.prototype.$local.get('dictConst'));
		} else {
			return state.common.dictConst;
		}
	},
	dictEnums: (state) => {
		if (Object.keys(state.common.dictEnums).length === 0) {
			return Vue.prototype.$local.get('dictEnums');
			// return Vue.prototype.$cryptoDecrypt(Vue.prototype.$local.get('dictEnums'));
		} else {
			return state.common.dictEnums;
		}
	},
	siteConfig: (state) => {
		if (state.common.siteConfig.length === 0) {
			return Vue.prototype.$local.get('siteConfig');
			// return Vue.prototype.$cryptoDecrypt(Vue.prototype.$local.get('siteConfig'));
		} else {
			return state.common.siteConfig;
		}
	},
	principalData: (state) => {
		if (state.business.principalData.length === 0) {
			return Vue.prototype.$local.get('principalData');
			// return Vue.prototype.$cryptoDecrypt(Vue.prototype.$local.get('principalData'));
		} else {
			return state.business.principalData;
		}
	},
	messageCount: (state) => {
		return state.business.messageCount;
	}
};
export default getters;